<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateMenusTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('menus', function (Blueprint $table) {
            $table->increments('id');
            $table->string('name',32)->comment('名字');
            $table->unsignedInteger('pid')->default('0')->common('父级id');
            $table->unsignedInteger('permission')->default('0')->common('权限id');
            $table->unsignedInteger('admin_id')->default('0')->comment('操作者id');
            $table->unsignedInteger('order')->default('0')->comment('排序id');
            $table->softDeletes()->comment('软删除字段');
            $table->timestamps();
            $table->index(['permission','pid']);
//            $table->index('pid');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('menus');
    }
}
